( prodos 8 )

( global page )

$bf00 constant mli

$bf58 constant prodos-bitmap \ $bf58..$bf6f

$bf90 constant prodos-date \ $bf90..$bf91
$bf92 constant prodos-time \ $bf92..$bf93

$bffd constant iversion
$bfff constant kversion

: prodos ( callnum "" -- )
  1 0 const-does> ( parmblock -- )
  mli @a jsr,
  t1, a2, ;

( access )

$80 constant access-destroy
$40 constant access-rename
$20 constant access-backup
$02 constant access-write
$01 constant access-read

( calls )

$c0 prodos p8-create

struct
  byte% field create>param_count  \ $7
  word% field create>pathname     \ pointer
  byte% field create>access       \ value
  byte% field create>file_type    \ value
  word% field create>aux_type     \ value
  byte% field create>storage_type \ value
  word% field create>create_date  \ value
  word% field create>create_time  \ value
end-struct create%

$c1 prodos p8-destroy

struct
  byte% field destroy>param_count \ $1
  word% field destroy>pathname    \ pointer
end-struct destroy%

$c2 prodos p8-rename

struct
  byte% field rename>param_count  \ $2
  word% field rename>pathname     \ pointer
  word% field rename>new_pathname \ pointer
end-struct rename%

$c3 prodos p8-set_file_info

struct
  byte% field set_file_info>param_count \ $7
  word% field set_file_info>pathname    \ pointer
  byte% field set_file_info>access      \ value
  byte% field set_file_info>file_type   \ value
  word% field set_file_info>aux_type    \ value
  tri%  field set_file_info>null_field
  word% field set_file_info>mod_date    \ value
  word% field set_file_info>mod_time    \ value
end-struct set_file_info%

$c4 prodos p8-get_file_info

struct
  byte% field get_file_info>param_count  \ $a
  word% field get_file_info>pathname     \ pointer
  byte% field get_file_info>access       \ result
  byte% field get_file_info>file_type    \ result
  word% field get_file_info>aux_type     \ result
  byte% field get_file_info>storage_type \ result
  word% field get_file_info>blocks_used  \ result
  word% field get_file_info>mod_date     \ result
  word% field get_file_info>mod_time     \ result
  word% field get_file_info>create_date  \ result
  word% field get_file_info>create_time  \ result
end-struct get_file_info%

$c5 prodos p8-on_line

struct
  byte% field on_line>param_count \ $2
  byte% field on_line>unit_num    \ value
  word% field on_line>data_buffer \ pointer
end-struct on_line%

$c6 prodos p8-set_prefix

struct
  byte% field set_prefix>param_count \ $1
  word% field set_prefix>pathname    \ pointer
end-struct set_prefix%

$c7 prodos p8-get_prefix

struct
  byte% field get_prefix>param_count \ $1
  word% field get_prefix>data_buffer \ pointer
end-struct get_prefix%

$c8 prodos p8-open

struct
  byte% field open>param_count \ $3
  word% field open>pathname    \ pointer
  word% field open>io_buffer   \ pointer
  byte% field open>ref_num     \ result
end-struct open%

$c9 prodos p8-newline

struct
  byte% field newline>param_count  \ $3
  byte% field newline>ref_num      \ value
  byte% field newline>enable_mask  \ value
  byte% field newline>newline_char \ value
end-struct newline%

$ca prodos p8-read

struct
  byte% field read>param_count   \ $4
  byte% field read>ref_num       \ value
  word% field read>data_buffer   \ pointer
  word% field read>request_count \ value
  word% field read>trans_count   \ result
end-struct read%

$cb prodos p8-write

struct
  byte% field write>param_count   \ $4
  byte% field write>ref_num       \ value
  word% field write>data_buffer   \ pointer
  word% field write>request_count \ value
  word% field write>trans_count   \ result
end-struct write%

$cc prodos p8-close

struct
  byte% field close>param_count \ $1
  byte% field close>ref_num     \ value
end-struct close%

$cd prodos p8-flush

struct
  byte% field flush>param_count \ $1
  byte% field flush>ref_num     \ value
end-struct flush%

$ce prodos p8-set_mark

struct
  byte% field set_mark>param_count \ $2
  byte% field set_mark>ref_num     \ value
  tri%  field set_mark>position    \ value
end-struct set_mark%

$cf prodos p8-get_mark

struct
  byte% field get_mark>param_count \ $2
  byte% field get_mark>ref_num     \ value
  tri%  field get_mark>position    \ result
end-struct get_mark%

$d0 prodos p8-set_eof

struct
  byte% field set_eof>param_count \ $2
  byte% field set_eof>ref_num     \ value
  tri%  field set_eof>eof         \ value
end-struct set_eof%

$d1 prodos p8-get_eof

struct
  byte% field get_eof>param_count \ $2
  byte% field get_eof>ref_num     \ value
  tri%  field get_eof>eof         \ result
end-struct get_eof%

$d2 prodos p8-set_buf

struct
  byte% field set_buf>param_count \ $2
  byte% field set_buf>ref_num     \ value
  word% field set_buf>io_buffer   \ pointer
end-struct set_buf%

$d3 prodos p8-get_buf

struct
  byte% field get_buf>param_count \ $2
  byte% field get_buf>ref_num     \ value
  word% field get_buf>io_buffer   \ result
end-struct get_buf%

$82 prodos p8-get_time

$40 prodos p8-alloc_interrupt

struct
  byte% field alloc_interrupt>param_count \ $2
  byte% field alloc_interrupt>int_num     \ result
  word% field alloc_interrupt>int_code    \ pointer
end-struct alloc_interrupt%

$41 prodos p8-dealloc_interrupt

struct
  byte% field dealloc_interrupt>param_count \ $1
  byte% field dealloc_interrupt>int_num     \ value
end-struct dealloc_interrupt%

$80 prodos p8-read_block

struct
  byte% field read_block>param_count \ $3
  byte% field read_block>unit_num    \ value
  word% field read_block>data_buffer \ pointer
  word% field read_block>block_num   \ value
end-struct read_block%

$81 prodos p8-write_block

struct
  byte% field write_block>param_count \ $3
  byte% field write_block>unit_num    \ value
  word% field write_block>data_buffer \ pointer
  word% field write_block>block_num   \ value
end-struct write_block%

$65 prodos p8-quit

struct
  byte% field quit>param_count \ $4
  byte% field quit>quit_type   \ value
  word% field quit>reserved0   \ pointer
  byte% field quit>reserved1   \ value
  word% field quit>reserved2   \ pointer
end-struct quit%

